const cfg = [
    {
        src_base: '/Users/linqc/Documents/fish_dict',
        dst_base: '/Users/linqc/Documents/fish_dict/output/common',
        items: [
            {
                src: 'dict_doc_chengyucidian',
                dst: 'cycd.fishdict'
            },
            {
                src: 'dict_doc_chengyudian',
                dst: 'cy.fishdict'
            },
            {
                src: 'dict_doc_dao',
                dst: 'dj.fishdict'
            },
            {
                src: 'dict_doc_guoyucidian',
                dst: 'gy.fishdict'
            },
            {
                src: 'dict_doc_hanyudacidian',
                dst: 'hy.fishdict'
            },
            {
                src: 'dict_doc_kangxizidian',
                dst: 'kx.fishdict'
            },
            {
                src: 'dict_doc_shuowenjiezi',
                dst: 'sw.fishdict'
            },
            {
                src: 'dict_doc_zhongwenzidian',
                dst: 'zwzd.fishdict'
            },
        ]
    },
    {
        src_base: '/Users/linqc/Documents/fish_dict/dict_doc_fo',
        dst_base: '/Users/linqc/Documents/fish_dict/output/fo',
        items: [
            {
                src: '阿毗達磨辭典',
                dst: 'apdmcd.fishdict'
            },
            {
                src: '禪林象器箋',
                dst: 'clxqj.fishdict'
            },
            {
                src: '禪宗語錄辭典 V1.3 ',
                dst: 'czylcd.fishdict'
            },
            {
                src: '法界次第初門',
                dst: 'fjcdcm.fishdict'
            },
            {
                src: '法門名義集',
                dst: 'fmmyj.fishdict'
            },
            {
                src: '法相辭典',
                dst: 'fxcd.fishdict'
            },
            {
                src: '翻譯名義大集',
                dst: 'fymydj.fishdict'
            },
            {
                src: '翻譯名義集',
                dst: 'fymyj.fishdict'
            },
            {
                src: '佛教器物',
                dst: 'fjqw.fishdict'
            },
            {
                src: '佛教人物傳 V2.1',
                dst: 'fjrwz.fishdict'
            },
            {
                src: '/Users/linqc/Documents/fish_dict/dict_doc_foguangdacidian',
                dst: 'fgdcd.fishdict'
            },
            {
                src: '/Users/linqc/Documents/fish_dict/dict_doc_wudenghuiyuan',
                dst: 'wdhy.fishdict'
            },
            {
                src: '佛學常見辭彙',
                dst: 'fxcjch.fishdict'
            },
            {
                src: '佛學次第統編',
                dst: 'fxcdtb.fishdict'
            },
            {
                src: '佛學大辭典',
                dst: 'fxdcd.fishdict'
            },

            {
                src: '南山律學辭典',
                dst: 'nslxcd.fishdict'
            },
            {
                src: '三藏法數',
                dst: 'szfs.fishdict'
            },
            {
                src: '釋氏要覽',
                dst: 'ssyl.fishdict'
            },
            {
                src: '唯識名詞白話新解',
                dst: 'wsmcbhxj.fishdict'
            },
            {
                src: '五譯合璧集要',
                dst: 'wyhbjy.fishdict'
            },
            {
                src: '英漢-漢英-英英佛學詞彙',
                dst: 'yhhyyyfxch.fishdict'
            },
            {
                src: '閱藏知津',
                dst: 'yzzj.fishdict'
            },
            {
                src: '中國佛教',
                dst: 'zgfj.fishdict'
            },
            {
                src: '祖庭事苑',
                dst: 'ztsy.fishdict'
            },
        ]
    }

]

const fish_dict = require('./index')
const path = require('path')

async function go() {
    for (let i = 0; i < cfg.length; ++i) {
        const cfgItem = cfg[i];
        for (let j = 0; j < cfgItem.items.length; ++j) {
            const dictItem = cfgItem.items[j]
            const srcDir = dictItem.src.startsWith('/') ? dictItem.src : path.join(cfgItem.src_base, dictItem.src)
            console.log('...srcDir', srcDir)
            await fish_dict.make_dict(srcDir, cfgItem.dst_base, dictItem.dst)
        }
    }
    console.log('..done')
}

go();